package routers

import (
	"api_server/internal/controllers"
	"api_server/internal/middleware"

	"github.com/gin-gonic/gin"
)

func RegisteBase(engine *gin.Engine) {
	openApi := engine.Group("open")
	authApi := engine.Group("auth").Use(middleware.VerifyToken())
	baseController := new(controllers.BaseController)
	openApi.GET("/design/qrcode", baseController.MakeDesignQrcode)
	//设计师工具获取扫码结果
	openApi.GET("/design/scan/result", baseController.GetDesignScanResult)
	//小程序扫码
	authApi.POST("/design/scan", baseController.SetDesignScanResult)
	//计算裁片前的预处理
	authApi.POST("/design/precalculate", baseController.PreCalculate)

	authApi.GET("/fashion/tps", baseController.GetFashionTps)
	authApi.POST("/fashion/list", baseController.GetFashionList)
	authApi.GET("/fashion/recommended", baseController.GetRecommendedFashions)
	//获取款式的面料
	authApi.GET("/fashion/fabric/list", baseController.GetFashionFabricList)

	authApi.GET("/fabric/list", baseController.GetFabricList)
	authApi.GET("/fabric/detail", baseController.GetFabricDetail)
	authApi.POST("/pattern/list", baseController.GetPatternList)
	authApi.GET("/pattern/detail", baseController.GetPatternDetail)
	authApi.POST("/pattern/diy/create", baseController.CreateDiyPattern)
	authApi.GET("/pattern/diy/list", baseController.GetDiyPattern)
	//款式详情
	authApi.GET("/fashion/detail", baseController.GetFashionDetail)
	//款式裁片列表
	authApi.GET("/fashion/cutpart/list", baseController.GetFashionCutpartList)

	authApi.POST("/works/collection/create", baseController.CreateWorksCollection)
	authApi.POST("/works/collection/update", baseController.UpdateWorksCollection)
	authApi.GET("/works/collection/list", baseController.GetWorksCollectionList)
	authApi.GET("/works/collection/detail", baseController.GetWorksCollectionDetail)
	authApi.POST("/works/collection/delete", baseController.DeleteWorksCollection)

	//创建客户需求
	authApi.POST("/need/create", baseController.CreateNeed)
	//更新客户需求
	authApi.POST("/need/update", baseController.UpdateNeed)
	//根据需求ID更新客户需求
	authApi.POST("/need/update/byid", baseController.UpdateNeedById)
	//客户需求管理
	authApi.POST("/need/list", baseController.GetNeedList)
	//客户需求详情
	authApi.GET("/need/detail", baseController.GetNeedDetail)
	//设计师的客户列表
	authApi.GET("/customer/list", baseController.GetCustomerList)
	//根据客户需求获取所有裁片
	authApi.GET("/need/cutparts", baseController.GetCutPartsByNeedId)
	//根据客户需求获取所有裁片的计算状态
	authApi.GET("/need/cutparts/calculate/status", baseController.GetCutPartsCalculateStatusByNeedId)
	//更新已经计算的裁片
	authApi.POST("/need/cutparts/update", baseController.UpdateNeedCutpart)

	//获取店铺详情
	authApi.GET("/store/detail", baseController.GetStoreDetail)
	//创建店铺
	authApi.POST("/store/create", baseController.CreateStore)
	//创建店铺的分组
	authApi.POST("/store/group/create", baseController.CreateStoreGroup)
	//获取店铺分组列表
	authApi.GET("/store/group/list", baseController.GetStoreGroupList)
	//获取店铺分组内的款式
	authApi.GET("/store/group/fashion/list", baseController.GetStoreGroupFashionList)
}
